package com.ruoyi.web.controller.system;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.RentalSysOrders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.YongRentalSysOrders;
import com.ruoyi.system.service.IYongRentalSysOrdersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 我的订单Controller
 * 
 * @author Mag1c_-xyy
 * @date 2024-04-27
 */
@RestController
@RequestMapping("/system/ordersYong")
public class YongRentalSysOrdersController extends BaseController
{
    @Autowired
    private IYongRentalSysOrdersService yongRentalSysOrdersService;

    /**
     * 查询我的订单列表
     */
    @PreAuthorize("@ss.hasPermi('system:ordersYong:list')")
    @GetMapping("/list")
    public TableDataInfo list(YongRentalSysOrders yongRentalSysOrders)
    {
        startPage();
        List<YongRentalSysOrders> list = yongRentalSysOrdersService.selectYongRentalSysOrdersList(yongRentalSysOrders);
        return getDataTable(list);
    }


    /**
     * 获取我的订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ordersYong:query')")
    @GetMapping(value = "/{orderId}")
    public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
    {
        return success(yongRentalSysOrdersService.selectYongRentalSysOrdersByOrderId(orderId));
    }

    /**
     * 修改我的订单
     */
    @PreAuthorize("@ss.hasPermi('system:ordersYong:edit')")
    @Log(title = "我的订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YongRentalSysOrders yongRentalSysOrders)
    {
        return toAjax(yongRentalSysOrdersService.updateYongRentalSysOrders(yongRentalSysOrders));
    }




}
